package net.sea.setup.ui.common;

import java.awt.Component;
import java.awt.HeadlessException;
import java.awt.Toolkit;

import javax.swing.JDialog;
import javax.swing.JFileChooser;

import net.sea.commons.constants.AppConstants;
import net.sea.commons.context.AppContext;
import net.sea.setup.config.Wizard;

/**
 * 文件选择对话器
 *
 * @author 华成伍
 *
 */
public final class OnTopFileChooser extends JFileChooser {

	private static final long serialVersionUID = 673192802716696583L;

	// 重写对话框样式
	protected JDialog createDialog(Component parent) throws HeadlessException {
		JDialog dialog = super.createDialog(parent);
		dialog.setAlwaysOnTop(true);
		// 设置系统Logo
		dialog.setIconImage(Toolkit.getDefaultToolkit().getImage(
				AppConstants.SYSTEM_PATH
						+ ((Wizard) AppContext.getInstance().getAttribute(
						AppConstants.CFG_WIZARD_KEY)).getSysLogo()));
		return dialog;
	}
}
